package com.ruoyi.controller;

import com.google.gson.Gson;
import com.ruoyi.system.service.other.SendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/pay/test")
public class MytestController {

    @Autowired
    private SendService sendService;

    public static void main(String[] args) {
        Map map = new HashMap();
        map.put("username","0xe0327be596AE3E172C8C8885D2104586e7Fd7294");
        Gson gson = new Gson();
        System.out.println(gson.toJson(map));
    }


    @RequestMapping("/send/{message}")
    @ResponseBody
    public void sendMessage(@PathVariable("message") String message) {
        for (int i = 0; i < 10; i++) {
            Map map = new HashMap<>();
            map.put("test",message);
//            sendService.sendMessage(map);
        }
    }

    @RequestMapping("/openThread")
    @ResponseBody
    public void openThread() {
//        consumer.start();
//        try {
//            Thread.sleep(2000L);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//        consumer.interrupt();
    }

}
